import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import nodejs from '@feidao/web/atom/browser/msg/nodejs';
import render from '@feidao/web/atom/browser/render/render';

import P02 from './P02';

export default async function a001(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	// 院部更改
	const department_no = fd.data.node.querySelector<HTMLSelectElement>('[data-feidao-id="department"]').value;
	if (!department_no) {
		// 清空专业信息
		render(fd, [], P02, 'P02', 'replace');
	} else {
		const major = await nodejs(fd.data.spaceid, 'specialty_find', { department_no });
		render(fd, major, P02, 'P02', 'replace');
	}
}
